package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@TableName("t_guarantee_institution")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.GuaranteeInstitutionMapper")
public class GuaranteeInstitutionDO extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 出函机构认证类型 数据字典
     */
    @TableField(value = "institution_type")
    private String institutionType;

    /**
     * 出函担保机构编码？内部编码
     */
    @TableField(value = "institution_code")
    private String institutionCode;

    /**
     * 出函担保机构统一社会信用代码：中心提交关联？
     */
    @TableField(value = "guarantor_credit_code")
    private String guarantorCreditCode;

    /**
     * 出函机构名称：以中心推送为准?
     */
    @TableField(value = "guarantor_name")
    private String guarantorName;

    /**
     * 接口地址
     */
    @TableField(value = "post_url")
    private String postUrl;

    /**
     * 备注说明
     */
    @TableField(value = "remark")
    private String remark;

    /**
     * 出函机构法人姓名
     */
    @TableField(value = "guarantor_legal_person")
    private String guarantorLegalPerson;

    /**
     * 出函机构法人证件类型 数据字典
     */
    @TableField(value = "guarantor_legal_idcard_type")
    private String guarantorLegalIdcardType;

    /**
     * 出函机构法人证件号
     */
    @TableField(value = "guarantor_legal_idcard")
    private String guarantorLegalIdcard;

    /**
     * 出函机构银行账号
     */
    @TableField(value = "bank_code")
    private String bankCode;

    /**
     * 出函机构联系地址
     */
    @TableField(value = "guarantor_address")
    private String guarantorAddress;

    /**
     * 出函机构email
     */
    @TableField(value = "guarantor_email")
    private String guarantorEmail;

    /**
     * 出函机构邮政编码
     */
    @TableField(value = "guarantor_postcode")
    private String guarantorPostcode;

    /**
     * 出函机构联系电话
     */
    @TableField(value = "guarantor_phone")
    private String guarantorPhone;

    /**
     * 出函机构税务号
     */
    @TableField(value = "guarantor_tax")
    private String guarantorTax;

    /**
     * 出函机构业务人员姓名
     */
    @TableField(value = "guarantor_business_name")
    private String guarantorBusinessName;

    /**
     * 出函机构业务人员电话
     */
    @TableField(value = "guarantor_business_tel")
    private String guarantorBusinessTel;

    /**
     * 出函机构技术人员姓名
     */
    @TableField(value = "guarantor_technology_name")
    private String guarantorTechnologyName;

    /**
     * 出函机构技术人员电话
     */
    @TableField(value = "guarantor_technology_tel")
    private String guarantorTechnologyTel;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 创建用户
     */
    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    /**
     * 更新用户
     */
    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    /**
     * 开票方式
     */
    @TableField(value = "invoice")
    private Integer invoice;

    /**
     * 开函所需天数0
     */
    @TableField(value = "open_days")
    private Integer openDays;

    /**
     * 保函查验地址
     */
    @TableField(value = "verify_url")
    private String verifyUrl;

    public GuaranteeInstitutionVo buildVo() {
        return new GuaranteeInstitutionVo(id, institutionType, institutionCode, guarantorCreditCode, guarantorName, postUrl, remark, guarantorLegalPerson, guarantorLegalIdcardType, guarantorLegalIdcard, bankCode, guarantorAddress, guarantorEmail, guarantorPostcode, guarantorPhone, guarantorTax, guarantorBusinessName, guarantorBusinessTel, guarantorTechnologyName, guarantorTechnologyTel, gmtCreate, gmtModified, userCreate, userModified, invoice, openDays, verifyUrl);
    }

    public static GuaranteeInstitutionDO of(GuaranteeInstitutionVo vo) {
        return new GuaranteeInstitutionDO(vo.getId(), vo.getInstitutionType(), vo.getInstitutionCode(), vo.getGuarantorCreditCode(), vo.getGuarantorName(), vo.getPostUrl(), vo.getRemark(), vo.getGuarantorLegalPerson(), vo.getGuarantorLegalIdcardType(), vo.getGuarantorLegalIdcard(), vo.getBankCode(), vo.getGuarantorAddress(), vo.getGuarantorEmail(), vo.getGuarantorPostcode(), vo.getGuarantorPhone(), vo.getGuarantorTax(), vo.getGuarantorBusinessName(), vo.getGuarantorBusinessTel(), vo.getGuarantorTechnologyName(), vo.getGuarantorTechnologyTel(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified(), vo.getInvoice(), vo.getOpenDays(), vo.getVerifyUrl());
    }
}
